#ifndef     __RCC_H
#define     __RCC_H

#include "./compat.h"
#include <utility>

namespace device::rcc {

constexpr uint32_t AHBFreq = 72000000;
constexpr uint32_t APB2Freq = AHBFreq;
constexpr uint32_t APB1Freq = AHBFreq / 2;

template <uint32_t base>
inline constexpr std::enable_if_t<(base == USART1_BASE), uint32_t> PeriphFreq = APB2Freq;

template <>
inline constexpr uint32_t PeriphFreq<USART2_BASE> = APB1Freq;

template <>
inline constexpr uint32_t PeriphFreq<USART3_BASE> = APB1Freq;

template <>
inline constexpr uint32_t PeriphFreq<UART4_BASE> = APB1Freq;

template <>
inline constexpr uint32_t PeriphFreq<UART5_BASE> = APB1Freq;

}


#endif
